<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\IntegralRule;

class IntegralRuleController extends Controller
{
    public function index(){
        //过期天数
        $pass_day = IntegralRule::getPassDay();
        //注册赠送的积分
        $register_integral = IntegralRule::getRegisterIntegral();
        //签到获赠积分
        $sign_integral = IntegralRule::getSignInIntegral();
        //积分兑换比例
        $ratio = IntegralRule::getRatio();
        $status = [
            "pass_day" => $pass_day?$pass_day:"N",
            "register_integral"=>$register_integral?$register_integral:"N",
            "sign_integral"=>$sign_integral?$sign_integral:"N",
            "ratio"=>$ratio?$ratio:"N",
        ];
        return response()->json($status)->setStatusCode(200);
    }
    //获取过期天数
    public function  show(Request $request){
        $pass_day = IntegralRule::getPassDay();
//        dd($pass_day);
        $return = [
            "data"=>$pass_day,
        ];
        return response()->json($return)->setStatusCode(200);
    }
}
